package com.atguigu.gmall.order.vo;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.math.BigDecimal;
import java.util.List;

/**
 * @author lfy
 * @Description
 * @create 2023-08-02 9:56
 */
@NoArgsConstructor
@Data
public class OrderSubmitDataVo {


    @NotNull(message = "收货人姓名必须指定")
    @JsonProperty("consignee")
    private String consignee; //收货人名

    @NotNull(message = "电话必须提交")
    @JsonProperty("consigneeTel")
    private String consigneeTel; //收货人电话

    @NotNull(message = "收货地址必须指定")
    @JsonProperty("deliveryAddress")
    private String deliveryAddress; //收货人地址


    @JsonProperty("orderComment")
    private String orderComment; //订单备注



    @JsonProperty("orderDetailList")
    private List<OrderDetailListDTO> orderDetailList; //订单商品清单


    @Validated
    @NoArgsConstructor
    @Data
    public static class OrderDetailListDTO {

        @NotNull(message = "商品id没有指定")
        @JsonProperty("skuId")
        private Long skuId;


        @JsonProperty("imgUrl")
        private String imgUrl;

        @JsonProperty("skuName")
        private String skuName;

        @JsonProperty("orderPrice")
        private BigDecimal orderPrice; //商品价格


        @NotNull(message = "请指定购买数量")
        @JsonProperty("skuNum")
        private Integer skuNum; //购买数量

        @JsonProperty("hasStock")
        private String hasStock; //是否有库存
    }
}
